<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
         // 子类
    class Dog {
      constructor(name, age) {
        // 实例属性
        this.age = age
        this.name = name
      }

      static abc = 123 // 静态属性
      static def() {
        //  静态方法
        console.log('456')
      }

      // 实例方法
      eat() {
        console.log(this.name + '在吃骨头')
      }
    }

    const dog = new Dog('来福', 8)
        //静态属性和方法只能class类名来调用
    console.log(Dog.abc)
    Dog.def()
    </script>
   
</body>
</html>